-- 예약
CREATE TABLE reserve(
 reserve_code NUMBER PRIMARY KEY, -- 예약 코드
 reserve_date VARCHAR2(16) NOT NULL, -- 예약일
 reserve_status VARCHAR2(20) NOT NULL, -- 예약 상태
 reserve_num NUMBER NOT NULL, -- 예약 인원 수
 id VARCHAR2(20) NOT NULL, -- 회원 ID
 reserver_name VARCHAR2(40) NOT NULL, -- 예약자 이름
 reserver_phone VARCHAR2(13) NOT NULL, -- 예약자 번호
 reserver_birth VARCHAR2(10) NOT NULL, -- 예약자 생년월일
 reserver_emergency_tel VARCHAR2(13) NOT NULL, -- 예약자 긴급 연락처
 demand varchar2(4000) NOT NULL, -- 요청사항
 product_code varchar2(16) NOT NULL, -- 상품 코드
 product_name varchar2(200) NOT NULL
 --,CONSTRAINT product_id_fk FOREIGN key (product_code) REFERENCES product_info(product_code)
 --회원 id를 foreign key 지정해야함
 );
 
CREATE SEQUENCE reserve_seq
	NOCYCLE
	NOCACHE;

 -- 결제
CREATE TABLE payment(
payment_method VARCHAR2(20) NOT NULL, -- 결제 수단
payment_day VARCHAR2(16) NOT NULL, -- 결제 일
payment_money NUMBER NOT NULL, -- 결제 금액
 reserve_code NUMBER NOT NULL, -- 예약 코드
CONSTRAINT payment_fk FOREIGN KEY (reserve_code) REFERENCES reserve(reserve_code)
);


select * from reserve;
	
		INSERT INTO	reserve(reserve_code, reserve_date, reserve_status, reserve_num, id, reserver_name, reserver_phone, 
					reserver_birth, reserver_emergency_tel, demand, product_code)	
		VALUES	(reserve_seq.nextval, 'a', 'b', 1, #{id, jdbcType=VARCHAR}, #{reserverName, jdbcType=VARCHAR}, 
				#{reserverPhone, jdbcType=VARCHAR},	#{reserverBirth, jdbcType=VARCHAR}, #{reserverEmergencyTel, jdbcType=VARCHAR}, #{demand, jdbcType=VARCHAR}, #{productCode, jdbcType=VARCHAR})

